<template>
	<view>
		<view style="background: linear-gradient(180deg,#e0f4ff, #f8f9f9);">
			<view class="u-flex u-row-between u-padding-30" v-if="user.id">
				<view class="u-flex" style="color: #333;">
					<view class="">
						<u-image :src="user.headimg" width="124" height="124" border-radius="100"></u-image>
					</view>
					<view class=" u-margin-left-20">
						<view class="u-font-weight u-font-34">{{user.nickname}}</view>

						<view class="u-margin-top-20 u-type-info u-font-22">
							手机号:{{user.mobile}}
						</view>
					</view>
				</view>
				<view>
					<view @click="$Go('/pages/user/info')" class="u-text-center">
						<image style="width: 80rpx;height: 68rpx;" :src="config.webLogo"></image>
					</view>
				</view>
			</view>
			<view @click="$Go('/pages/register/app')" v-else style="font-size: 34rpx;color: #fff;" class="u-flex">
				<image style="width: 124rpx;height: 124rpx;border-radius: 100%;" :src="config.webLogo"
					mode="aspectFill"></image>
				<view class="u-font-weight u-margin-left-20">点击登陆</view>
			</view>
		</view>

		<view :style="{backgroundImage:'url('+$ftpUrl('/my_banner.png')+')'}"
			style="width:680rpx;background-size: contain;background-repeat:no-repeat;margin: auto;">
			<view style="padding: 40rpx 130rpx;color: #fff;font-size: 22rpx;">
				<view>{{user.levelName}}</view>
				<view>消费可享优惠哦~</view>
			</view>
			<view style="border-radius: 0px 0px 8px 8px;
box-shadow: 0px 2px 8px 0px rgba(197,197,197,0.30);padding: 20rpx; " class="u-flex u-row-around">
				<view class="u-flex" @click="$Go('/pages/my/coupond')">
					<image src="/static/my_1.png" style="width: 96rpx;height: 96rpx;"></image>
					<view class="u-margin-left-20">
						<view class="u-font-32 u-font-weight">{{user.couponNum}}</view>
						<view class="u-font-22">我的优惠券</view>
					</view>
				</view>
				<view class="u-flex" @click="$Go('/pages/my/wallet')">
					<image src="/static/logo_add.png" style="width: 60rpx;height: 60rpx;"></image>
					<view class="u-margin-left-20">
						<view class="u-font-32 u-font-weight">{{user.balance}}</view>
						<view class="u-font-22">我的龙分</view>
					</view>
				</view>
			</view>
		</view>


		<view style="border-radius: 0px 0px 8px 8px;
box-shadow: 0px 2px 8px 0px rgba(197,197,197,0.30);padding: 40rpx; width: 700rpx;margin:40rpx auto;">
			<u-section title="更多服务" :right="false" line-color='#4F8BFF'></u-section>


			<view class="u-flex" style="flex-wrap: wrap;">
				<view @click="$Go('/pages/my/card')" class="u-text-center" style="width: 33%;margin-top: 40rpx;">
					<image src="/static/my_9.png" style="width: 48rpx;height: 48rpx;"></image>
					<view>我的卡包</view>
				</view>
				<view @click="dingdan" class="u-text-center" style="width: 33%;margin-top: 40rpx;">
					<image src="/static/my_9.png" style="width: 48rpx;height: 48rpx;"></image>
					<view>订单记录</view>
				</view>
				<view @click="$Go('/pages/my/chargeList')" class="u-text-center" style="width: 33%;margin-top: 40rpx;">
					<image src="/static/my_8.png" style="width: 48rpx;height: 48rpx;"></image>
					<view>消费记录</view>
				</view>
				<view @click="$Go('/pages/my/invite')" class="u-text-center" style="width: 33%;margin-top: 40rpx;">
					<image src="/static/my_3.png" style="width: 48rpx;height: 48rpx;"></image>
					<view>邀请好友</view>
				</view>
				<view @click="$Go('/pages/my/inviteFriend')" class="u-text-center"
					style="width: 33%;margin-top: 40rpx;">
					<image src="/static/my_4.png" style="width: 48rpx;height: 48rpx;"></image>
					<view>邀请列表</view>
				</view>
				<view v-if="user.role" @click="$Go('/pages/myStore/index')" class="u-text-center"
					style="width: 33%;margin-top: 40rpx;">
					<image src="/static/my_5.png" style="width: 48rpx;height: 48rpx;"></image>
					<view>我是店主</view>
				</view>
				<view class="u-text-center" style="width: 33%;margin-top: 40rpx;position: relative;">
					<image src="/static/my_6.png" style="width: 48rpx;height: 48rpx;"></image>
					<view>联系客服</view>
					<button open-type="contact" class="custom-btn"></button>
				</view>
				<view class="u-text-center" @click="$Go('/pages/my/about?id=7')" style="width: 33%;margin-top: 40rpx;">
					<image src="/static/my_7.png" style="width: 48rpx;height: 48rpx;"></image>
					<view>关于我们</view>
				</view>
				<view class="u-text-center" @click="$Go('/pages/my/vipRender')" style="width: 33%;margin-top: 40rpx;">
					<image src="/static/my_7.png" style="width: 48rpx;height: 48rpx;"></image>
					<view>会员排行</view>
				</view>
				
				
				<!-- <view @click="$Go('/pages/my/getCoupond')" class="u-text-center" style="width: 33%;margin-top: 40rpx;">
					<image src="/static/douyin.png" style="width: 48rpx;height: 48rpx;"></image>
					<view>自助验券</view>
				</view> -->
			</view>
		</view>

	</view>
</template>

<script>
	export default {
		data() {
			return {
				user: {
					headimg: '/static/logo_add.png'
				},
			}
		},
		methods: {
			getUser() {
				this.$u.api.userInfo().then(res => {
					this.user = res;
				})
			},
			dingdan(){
				uni.switchTab({
					url:"/pages/my/bookList"
				})
			}
		},

		onLoad() {
			this.getUser()

		}
	}
</script>

<style>
</style>